<template>
    <div>
        <!-- 顶部tabbar -->
         <div class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted myca">
                <div class="mui-scroll">
                    <!-- 'mui-active':index==item.id||index==0 -->
                    <a :class="['mui-control-item',{'mui-active':index==item.id||index==0}]" v-for="(item,index) in tabarList" :key="item.id" @click="getpiclist(item.id)">
                        <!-- mui-control-item  mui-active -->
                        {{item.name}}
                    </a>
                </div>
         </div> 

         <!-- 列表   -->
         <ul class="piclist">
             <router-link  v-for="pic in piclist" :key="pic.id" tag="li" :to="'/home/picDetail/'+pic.id">
                 <div class="imgbox">
                        <img :src='pic.images[0]' alt="">
                 </div>
                 <div class="imgcontent">
                     的味道群多驱动器和底气的环球汇会对我去带回去的hi去我的话IQ花都区文化对轻微的回去我都会不断进步驱动器我hi对不起的起步hi去和地区我会丢球后很低强无敌hi期望和地球的环球和地区雾的后期无ID环球的好渠道渠道群无的期望地区
                 </div>
             </router-link>
         </ul>
    </div>
</template>
<script>
import mui from '../../assets/dist/js/mui.min.js'
// mui('.mui-scroll-wrapper').scroll({
// 	deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
// });
export default {
    data() {
        return {
            tabarList:[],
            piclist:[{
                images:[]
            }]
        }
    },
    created(){
        this.gettabbar();
        this.getpiclist(1);
    },
    mounted(){
        mui('.mui-scroll-wrapper').scroll({
            deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
        });
    },
    methods:{
        gettabbar(){
            this.$http({
                method:'get',
                url:'https://locally.uieee.com/categories'
            }).then(res=>{
                // console.log(res);
                this.tabarList=res.data;     
            })
        },
        getpiclist(id){
            this.$http({
                method:'get',
                url:'https://locally.uieee.com/categories/'+id+'/shops'
            }).then(res=>{
                console.log(res);
                this.piclist=res.data;
            })
        }
    }
}
</script>
<style scoped>
    .mui-scroll-wrapper.myca{
        height:50px;
    }
</style>

